package game.utils
{
	import flash.filters.DropShadowFilter;
	import flash.filters.GlowFilter;
	import flash.geom.Point;
	import flash.text.TextField;
	import flash.text.TextFieldType;
	import flash.text.TextFormat;
	
	/**
	 * 工具类
	 * @author xiezhicheng
	 */
	public class Utils
	{
		public static const _glow0x664D00:GlowFilter = new GlowFilter(0x664D00,1,3,3,15,3);
		public static const _drop0x664d00:DropShadowFilter = new DropShadowFilter(2.5,90,0x664d00);
		public static const _glowFFFFFF:GlowFilter = new GlowFilter(ColorConstant.getColorInt(7), 1, 2, 2, 10);
		public static const _glow000000:GlowFilter = new GlowFilter(0x000000, 1, 2, 2, 15,3);
		
		
		public function Utils()
		{
		}
	
		/**
		 * (黄色加粗发光)滤镜字体设置
		 * @param text
		 * @param textField
		 * @param format
		 * @param color
		 */
		public static function getTextField(text:String, size:int=12,color:uint = 0xfbbb35,textField:TextField=null,isMouse:Boolean=false):TextField
		{
			if (!textField){
				textField = new TextField();
			}
			
			
			textField.defaultTextFormat = new TextFormat(null,size);
			textField.textColor = color;
		//	setPropertie(textField.defaultTextFormat, propertie);
			textField.filters = [_glow0x664D00,_drop0x664d00];
			textField.selectable = isMouse;
			textField.mouseEnabled = isMouse;
			textField.type=TextFieldType.DYNAMIC;
//			textField.x=x;
//			textField.y=y;
			textField.text=text;
			
			return textField;
		}
		
		
		/**
		 * (白色发光)普通字体属性
		 * @param text 文字
		 * @param size	字体大小
		 * @param format
		 * @param color
		 */
		public static function getCommonTextField(text:String="", size:int=12,x:int=0,y:int=0,color:int=0x000000,isMouse:Boolean = false,leading:int=0,align:String='left'):TextField {
			var textField:TextField = new TextField();
			var textFormat:TextFormat=new TextFormat("宋体", size, color);
			textFormat.leading=leading;
			textFormat.align=align;
			textField.defaultTextFormat = textFormat;
			textField.selectable = isMouse;
			textField.mouseEnabled = isMouse;
			textField.text = text;
			textField.filters = [_glowFFFFFF];
			textField.width = textField.textWidth + 4;
			textField.height = textField.textHeight + 4;
			textField.x = x;
			textField.y = y;
			return textField;
		}
//		public static function setPropertie(object:*,propertie:Object):void
//		{
//			if (object == null) 
//				throw(new Error("异常：setPropertie 传递对象object为 null"));
//			for(var key:String in propertie)
//				object[key] = propertie[key];
//		}
	}
}
